using System.Collections.Generic;

using lucere.index.write;

namespace lucere.index.inversion
{
    public interface IInvertedDocumentConsumer
    {
          
        /// <summary>
        /// Add a new thread
        /// </summary>
        /// <param name="docInverterPerThread"></param>
        /// <returns></returns>
        IInvertedDocumentConsumerPerThread AddThread(IDocumentInverterPerThread docInverterPerThread);

        /// <summary>
        /// Abort (called after hitting AbortException)
        /// </summary>
        void Abort();

        /// <summary>
        /// Flush a new segment 
        /// </summary>
        /// <param name="threadsAndFields"></param>
        /// <param name="state"></param>
        void Flush(IDictionary<IInvertedDocumentConsumerPerThread, IList<IInvertedDocumentConsumerPerField>> threadsAndFields, ISegmentWriteState state);

        
        /// <summary>
        /// Close doc stores 
        /// </summary>
        /// <param name="state"></param>
        void CloseDocStore(ISegmentWriteState state);

        /// <summary>
        /// Attempt to free RAM, returning true if any RAM was freed
        /// </summary>
        /// <returns></returns>
        bool FreeRAM();

        IFieldInfos FieldInfos { get; set; } 
    }
}